package com.yc.cinema.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.w3c.dom.TypeInfo;

import com.yc.cinema.service.IFilmTypeService;
import com.yc.cinema.service.impl.FilmTypeServiceImpl;

@WebServlet("/types/*")
public class FilmTypeController extends BaseController {
	private static final long serialVersionUID = -4297121285068564999L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req,resp);
	}
	
	/**
	 * 查询所有电影类型
	 * @param request
	 * @param response
	 * @throws IOException 
	 */
	public void finds(HttpServletRequest request, HttpServletResponse response) throws IOException {
		IFilmTypeService filmTypeService = new FilmTypeServiceImpl();
		List<TypeInfo> ft = filmTypeService.findAll();
		if(ft != null && !ft.isEmpty()) {
			System.out.println(ft);
			this.send(response, 200, ft);
			return;
		}
		this.send(response, 600, "暂无数据");
	}
}
